<template>
  <view>
	<view class="nav">
		<view style="display: flex;justify-content: center;align-items: center;padding-right: 20rpx;" :style="'color:'+ navColor+';background-color:'+navBackground">
			<view class="u-p-30" @click="location">
				<text style="font-size: 16px;">杭州市</text>
				<u-icon name="arrow-down-fill" class="u-p-l-20" size="18"></u-icon>
			</view>
			<u-search placeholder="搜索家庭服务" v-model="keyword" input-align="left"  :show-action="false" :clearabled="true"
			:disabled="true"  @click="search"></u-search>
		</view>
	</view>
    <view>
      <u-swiper
        :list="swiperList"
        height="900"
        interval="8000"
        mode="none"
      ></u-swiper>
    </view>
	<view class="swiperSmall-wrap">
	  {{swiperSmallTitle}}
	</view>
	<view class="swiperBig-wrap">
	  {{swiperBigTitle}}
	</view>
    <view class="header-summary">
       <view class="title">您需要什么服务？</view>
	   <view class="body" @click="category">
		   <view class="item">
			   <image :src="cover1" mode="widthFix" class="img"></image>
		   </view>
		   <view class="item">
			   <image :src="cover2" mode="widthFix" class="img"></image>
		   </view>
		   <view class="item">
			   <image :src="cover3" mode="widthFix" class="img"></image>
		   </view>
	   </view>
	   <view class="footer"  @click="categoryDetail">
		   <view class="item">
		   		<image :src="shutong" mode="widthFix" class="img"></image>
		   </view>
		   <view class="item">
		   		<image :src="dakong" mode="widthFix" class="img"></image>
		   </view>
		   <view class="item">
		   		<image :src="baoying" mode="widthFix" class="img"></image>
		   </view>
		   <view class="item">
		   		<image :src="chaijiu" mode="widthFix" class="img"></image>
		   </view>
		   <view class="item">
		   		<image :src="banyun" mode="widthFix" class="img"></image>
		   </view>
	   </view>
	   <view class="bottom" @click="category">
		   全部服务<u-icon name="arrow-right"></u-icon>
	   </view>
    </view>
	<view class="service">
	   <view class="item">
		   <view class="title">
			   140万+
		   </view>
		   <view class="desc">
				专业入驻师傅
		   </view>
	   </view>
	   <view class="item">
		   <view class="title">
			   6000万+
		   </view>
		   <view class="desc">
				累计服务订单
		   </view>
	   </view>
	   <view class="item">
		   <view class="title">
			   99%
		   </view>
		   <view class="desc">
				服务好评率
		   </view>
	   </view>
	</view>
	<view v-if="tip" class="tipMessage" @click="callPhoneNumber">
	  <u-icon name="server-man" color="#999" size="60"></u-icon>
	</view>
  </view>
</template>

<script>
import config from "common/config.js" // 全局配置文件
export default {
  data() {
    return {
	  keyword: '',
	  scrollTop:0,
	  navColor:'#fff',
	  navBackground:'transparent',
      swiperList: [
        {
        	image: '/static/img/index/swiper/swiper.jpg',
        },
      ],
	  swiperSmallTitle: '智慧家居',
	  swiperBigTitle: '追求极致的服务体验',
	  cover1:'/static/img/index/cover/index_cover1.png',
	  cover2:'/static/img/index/cover/index_cover2.png',
	  cover3:'/static/img/index/cover/index_cover3.png',
	  shutong:'/static/img/index/cover/shutong.png',
	  dakong:'/static/img/index/cover/dakong.png',
	  baoying:'/static/img/index/cover/baoying.png',
	  chaijiu:'/static/img/index/cover/chaijiu.png',
	  banyun:'/static/img/index/cover/banyun.png',
	  receive:'/static/img/index/cover/new_receive_bg.png',
	  hotArticle:[],
	  tip:false
    };
  },
  onLoad: function () {
  },
  onPageScroll(e) {
  	this.scrollTop = e.scrollTop;
	if(this.scrollTop>44){
		this.navColor='#333'
		this.navBackground='#fff'
		this.tip = true
	}else{
		this.navColor='#fff'
		this.navBackground='transparent'
		this.tip = false
	}
  },
  methods: {
	  code(){
	  	this.$mytip.toast('请咨询作者')
	  },
	  location(){
		  this.$u.route({
		  	url: 'pages/location/location',
		  })
	  },
	  search(){
	  	this.$u.route({
	  		url: 'pages/search/search',
	  	})
	  },
	  callPhoneNumber() {
	    uni.makePhoneCall({
	      phoneNumber: "18720989281",
	    });
	  },
	  clickWork(item) {
	   uni.makePhoneCall({
	     phoneNumber: "18720989281",
	   });
	  },
	  clickMore(item) {
	    uni.makePhoneCall({
	      phoneNumber: "18720989281",
	    });
	  },
	  category(){
		uni.switchTab({
			url:'../category/category'
		})
	  },
	  categoryDetail(){
		this.$u.route({
			url: 'pages/category/categoryDetail',
		})
	  },
  },
};
</script>

<style>
page {
  background-color: #ffffff;
}
</style>

<style lang="scss" scoped>
	.nav{
	  position: fixed; top: 50rpx; left: 0; right: 0; /* 决定了搜索框置顶 */
	  /* #ifdef H5 */
	  height: fixed; top: 0; left: 0; right: 0;
	  /* #endif */
	  height: 44px;
	  z-index: 101;
	}
	.swiperSmall-wrap{
		position: absolute;
		top:180rpx;
		left:50rpx;
		z-index: 100;
		font-size: 68rpx;
		color: #fff;
		font-weight: 700;
		text-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
	}
	.swiperBig-wrap{
		position: absolute;
		top:320rpx;
		left:140rpx;
		z-index: 100;
		font-size: 48rpx;
		color: #fff;
		font-weight: 700;
		text-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
	}
	.header-summary {
	  width: 90%;
	  height: 300px;
	  margin: -220px auto 0;
	  overflow: hidden;
	  position: relative;
	  z-index: 100;
	  border-radius: 8px;
	  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15);
	  background-color: #fff;
	  .title{
		  font-size: 38rpx;
		  color: #303133 ;
		  font-weight: 700;
		  text-align: center;
		  padding: 15px 0;
	  }
	  .body{
		  margin: 0 20rpx;
		  height: 240rpx;
		  display: flex;
		  justify-content: space-around;
		  align-items: center;
		  .item{
			  .img{
				  width: 180rpx;
			  }
		  }
	  }
	  .footer{
		  margin: 0 20rpx;
		  height: 130rpx;
		  display: flex;
		  justify-content: space-around;
		  align-items: center;
		  .item{
			  .img{
				  width: 100rpx;
			  }
		  }
	  }
	  .bottom{
		font-size: 32rpx;
		color: #909399  ;
		text-align: center;
	  }
	}
	.service{
		padding: 0 20rpx;
		height: 160rpx;
		display: flex;
		justify-content: space-around;
		align-items: center;
		box-shadow: 0 6px 0 rgba(0, 0, 0, 0.01);
		border-radius: 8px;
		.item{
			.title{
				font-size: 18px;
				color: #0ab0ed  ;
				font-weight: 600;
				line-height: 2;
			}
			.desc{
				font-size: 22rpx;
				color: #909399  ;
			}
		}
	}
	
	.news {
	  .container {
	    width: 100%;
	    margin-right: auto;
	    margin-left: auto;
		margin-top: 20rpx;
	    .w-title {
	      position: relative;
	      height: 124px;
	      text-align: center;
	      line-height: 1;
	      .i_title {
	        position: absolute;
	        top: 50px;
	        left: 20px;
	        height: 44px;
	        line-height: 36px;
	        font-size: 24px;
	        color: #000;
	        &::after {
	          position: absolute;
	          top: 44px;
	          left: 0;
	          margin: 0;
	          display: block;
	          content: "";
	          width: 40px;
	          height: 4px;
	          border-radius: 2px;
	          background: #0ab0ed;
	        }
	      }
	      .i_sub {
	        position: absolute;
	        top: 20px;
	        left: 20px;
	        font-size: 14px;
	        color: #0ab0ed;
	        margin: 0;
	        line-height: 1;
	      }
	    }
	    .news-list {
	      width: 100%;
	      padding: 0 10px;
	      box-sizing: border-box;
	      .news-item {
	        float: none;
	        width: auto;
	        height: 112px;
	        padding: 20px 0;
	        border-bottom: 1px solid #ededed;
	        box-sizing: border-box;
	        display: block;
	        margin: 0 2%;
	        border-radius: 4px;
	        .icon-product {
	          float: left;
	          width: 100px;
	          height: 78px;
	          margin: 0 14px 20px 0;
	          background-size: 100px 78px;
	          display: block;
	          background-repeat: no-repeat;
	          background-position: center center;
	        }
	        .title {
	          height: 28px;
	          margin-bottom: 10px;
	          line-height: 20px;
	          text-align: left;
	          font-size: 16px;
	          font-weight: bold;
	          color: #333;
	        }
	        .desc {
	          font-size: 15px;
	          color: #999;
	          overflow: hidden;
	          text-overflow: ellipsis;
	          display: -webkit-box;
	          -webkit-box-orient: vertical;
	          -webkit-line-clamp: 2;
	        }
	      }
	    }
	  }
	}
	
	.footer {
	  height: 120rpx;
	  line-height: 120rpx;
	  overflow: hidden;
	  text-align: center;
	  color: #999;
	  margin-right: 260rpx;
	}
	
	.tipMessage {
	  font-size: 14px;
	  position: fixed;
	  right: 50rpx;
	  bottom: 130rpx;
	  width: 60px;
	  height: 60px;
	  padding: 4px;
	  cursor: pointer;
	  background: #fff;
	  text-align: center;
	  line-height: 60px;
	  border-radius: 100%;
	  -webkit-box-shadow: 0px 1px 20px 0px rgba(0, 0, 0, 0.1),
	    inset 0px -1px 0px 0px rgba(0, 0, 0, 0.1);
	  box-shadow: 0px 1px 20px 0px rgba(0, 0, 0, 0.1),
	    inset 0px -1px 0px 0px rgba(0, 0, 0, 0.1);
	}
	
</style>
